package com.cheetah.rest;

import com.cheetah.builder.Result;
import com.cheetah.builder.ResultBuilder;
import com.cheetah.dto.UserDTO;
import com.cheetah.entity.User;
import com.cheetah.service.UserService;
import com.cheetah.vo.RegisterUserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Administrator
 * @Date 2019/10/8
 * @Version V1.0
 * @Description:
 **/
@RestController
@RequestMapping("/user")
@Slf4j
public class RegisterRest {

    @Autowired
    private UserService userService;

    @PostMapping(value = "/register")
    public Result<UserDTO> login(RegisterUserVO registerUserVO){
        UserDTO user = userService.register(registerUserVO);
        return ResultBuilder.builder().success(user);
    }
}
